package com.fejal.bean;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

@Entity
public class AlunoCracha {

	@Id
	@GeneratedValue (strategy = GenerationType.AUTO)
	private int codigoAlunoCracha;

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "codigoAluno", insertable = true, updatable = true)
	@Fetch(FetchMode.JOIN)
	@Cascade(CascadeType.SAVE_UPDATE)
	private Aluno aluno;

	@Column (nullable = false)
	@Temporal(TemporalType.DATE)
	private Date data;

	public AlunoCracha() {
	}

	public int getCodigoAlunoCracha() {
		return codigoAlunoCracha;
	}

	public void setCodigoAlunoCracha(int codigoAlunoCracha) {
		this.codigoAlunoCracha = codigoAlunoCracha;
	}

	public Aluno getAluno() {
		return aluno;
	}

	public void setAluno(Aluno aluno) {
		this.aluno = aluno;
	}

	public Date getData() {
		return data;
	}

	public void setData(Date data) {
		this.data = data;
	}
}
